<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
    <title>登录页</title>
</head>

<body>
<div class="std-main">
    <div class="container">
        <div class="form-group std-login-auto std-login-large">
            <form role="form" id="loginForm" action="${ctx}/login" method="post" class="form-horizontal">
                <fieldset>
                    <h4 class="entry-title">系统登录</h4>
                    <%
                        String error = (String) request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME);
                        if (error != null) {
                    %>
                    <div class="alert alert-error input-medium controls">
                        <button class="close" data-dismiss="alert">×</button>
                        登录失败，请重试.
                    </div>
                    <%
                        }
                    %>
                    <div class="control-group">
                        <label for="username" class="control-label" style="font-size: 16px;margin-bottom: 10px">名称:</label>
                        <div class="controls">
                            <input type="text" class="form-control required" id="username" name="username" value="${username}"/>
                        </div>

                    </div>
                    <div class="control-group">
                        <label for="password" class="control-label" style="font-size: 16px;margin-bottom: 10px">密码:</label>
                        <div class="controls">
                            <input type="password" id="password" name="password" class="form-control required"/>
                        </div>
                    </div>

                    <div class="control-group">
                        <div class="controls std-login-check">
                            <input id="submit_btn" class="" type="submit" value="登录"/>
                            <div class="login-footer">
                                <label class="checkbox" for="rememberMe"><input type="checkbox" id="rememberMe" name="rememberMe"/>
                                    记住我</label>
                                <a class="register-btn" href="${ctx}/register">新用户注册</a>
                            </div>
                        </div>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        $("#loginForm").validate();
    });

</script>
</body>
</html>
